(c) a trust is deemed to be a corporation all the voting shares in the capital stock of whichi. in the case of a testamentary trust under which one or more beneficiaries are entitled to receive all of the income of the trust that arose before the date of death of one or the last surviving of those beneficiaries, in this subparagraph c referred to as the “distribution date”, and under which no other person can, before the distribution date, receive or otherwise obtain the enjoyment of any of the income or capital of the trust,(1) where any such beneficiary’s share of the income or capital of the trust depends on the exercise by any person of, or the failure by any person to exercise, a power to appoint, and where that time occurs before the distribution date, are owned at that time by the beneficiary,
(2) where subparagraph 1 does not apply and where that time occurs before the distribution date, are owned at that time by the beneficiary in a proportion equal to the proportion that the fair market value of the beneficial interest in the trust of the beneficiary is of the fair market value of the beneficial interests in the trust of all the beneficiaries,
ii. where a beneficiary’s share of the accumulating income or capital of the trust depends on the exercise by any person of, or the failure by any person to exercise, a power to appoint, are owned at that time by the beneficiary, except where subparagraph i applies and that time occurs before the distribution date,
iii. in any case where subparagraph ii does not apply, are owned at that time by the beneficiary in a proportion equal to the proportion that the fair market value of the beneficial interest in the trust of the beneficiary is of the fair market value of all beneficial interests in the trust, except where subparagraph i applies and that time occurs before the distribution date, and
iv. in the case of a trust referred to in section 467, are owned at that time by the person referred to therein from whom property of the trust or property for which it was substituted was directly or indirectly received.